<template>
    <div class="adds">
        <el-form :inline="true" size="large">
            <inp label="订单编号: " />
            <inp label="商品名称: " />
            <inp label="收件信息: " />
            <inp label="收件名字: " />
            <inp label="订单来源: " />
            <inp label="支付方式: " />
            <inp label="下单时间: " />
            <but />
        </el-form>
        <tab :head="header1" :foo="tabelsjalldd">
            <el-radio-group size="large">
                <el-radio-button label="全部" />
                <el-radio-button label="待付款" />
                <el-radio-button label="待付款" />
                <el-radio-button label="待发货" />
                <el-radio-button label="待评价" />
            </el-radio-group>
            <template #but="butPorps"  >
                <Dialog @subadd="Change(butPorps,onlyId)" >修改</Dialog>
                <el-button @click="shanChu(butPorps,onlyId)" :id="butPorps.text.id" >删除</el-button>
            </template>
        </tab>
    </div>
</template>
<script setup>
</script>


<style scoped>
.el-form {
    background-color: white;
    padding: 10px;
}
</style>
<style>
.el-radio-group{
    margin:15px
}
.adds{
    display: flex;
    flex-direction: column;
    height: 100%;
}
</style>

<script setup>
import { onMounted, computed,reactive,provide,ref } from "vue"
// import { useCounterStore } from "../";
import { useCounterStore } from "../../pinia/index.js"
import { res } from "@/unit/index.js"
import { onlyId } from "../../commonjs/router-tabel-id"
import { loading,Delete,xiugai } from "../../commonjs/index.js"
const header1 = [{ key: 'number', name: "订单编号" }, { key: 'name', name: "货单编号" }, { key: "same", name: "商品名称" },{ key: "xs", name: "订单评价" },{ key: "hhh", name: "实付" }]
const tagleft1 = [{name:"全部订单",path:"/start/sp/alldd"},{name:"订单评价",path:"/start/sp/ddpj"}]

const splist = JSON.parse(localStorage.getItem("onlyId"))
//渲染dom数据
const tabelsjalldd = ref([])

onMounted(() => {
    const usertag = useCounterStore()
    usertag.$patch({
        taglet:tagleft1,
        formListName: header1,
    })
    const sj =  loading(onlyId.value).then(data=>{
        tabelsjalldd.value = data
    })
})

function shanChu(sj,onlyid){
    Delete(sj, onlyid)
        .then(data => {
            tabelsjalldd.value = data
            localStorage.setItem(onlyid, JSON.stringify(tabelsjalldd))
        })
}
//修改
function Change(e,id){
    xiugai(e,id)
    .then(data => {
            tabelsjalldd.value = data
            // localStorage.setItem(onlyId, JSON.stringify(onlyId))
        })
}

provide("csstable","margin:15px")
</script>